<html>

    <?php
    echo $this->render("/common/header.phtml");
    ?>

    <script>  

        function deleteApp(id){
            var baseUrl = <?php echo '"' . $this->delete . '"' ?>   
            var a = baseUrl+"?id="+id;               
            ajax.get(a,null,function(f){
                alert(f);
            },null);            
        }

    </script>

    <body>
        <?php
        echo $this->render("/common/topMenu.phtml");
        ?>
    <center>
        <div id="tbSite" class="tbsite" >
            <form action="<?php echo $this->baseAdd ?>" >
                <table border="0px" id="gradient-style">
                    <tr>
                        <th>App Id</th>
                        <th>API Key</th>
                        <th>SECRET Key</th>
                        <th>Holder</th>
                        <th>Commit</th>
                    </tr>
                    <tr>
                        <th><input type="text" id="appId"  name="appId" /></th>
                        <th><input type="text" id="apik" name="apik" /></th>
                        <th><input type="text" id="secretk" name="secretk"  /></th>
                        <th><input type="text"id="holder"  name="holder"/></th>
                        <th><input type="submit" value="Insert" /></th>
                    </tr>                    
                </table>

            </form>               
            <table border="0px" id="gradient-style" style="width: 80%">
                <?php
                echo "<tr>
                        <th>App Id</th>
                        <th>API Key</th>
                        <th>SECRET Key</th>
                        <th>Holder</th>
                        <th>Delete</th>
                      </tr>";
                foreach ($this->apps as $data) {

                    echo '  <tr> ';
                    echo '      <td> ' . $data[Model_App::$APPID] . '</td>';
                    echo '      <td> ' . $data[Model_App::$API_KEY] . '</td>';
                    echo '      <td> ' . $data[Model_App::$SECRET_KEY] . '</td>';
                    echo '      <td> ' . $data[Model_App::$HOLDER] . '</td>';
                    echo '      <td> <input type="button" onclick="deleteApp(' . $data[Model_App::$APPID] . ') " value="Delete" /></td>';
                    echo '  </tr> ';
                }
                ?>
            </table>

        </div>
    </center>
</body>

</html>
